<script setup lang="ts">
import { PoleDataAPI } from '@/apis/pole';
import type {  poleParams, poleResDataItem } from '@/types/pole';
import { ref } from 'vue';

const PoleParams = ref<poleParams>({
  page: '1', // 页数
  pageSize: '10', // 每页条数
  poleName: '', //一体杆名称
  poleNumber: '', //一体杆编号
  poleStatus: '', //运行状态
})

const PoleDataList = ref<poleResDataItem[]>([])

const getPoleDataList = async () => {
  const res = await PoleDataAPI(PoleParams.value)
  PoleDataList.value = res.data.rows
}
getPoleDataList()
</script>

<template>
  <div class="search-box">
    <span>一体杆名称: </span>
    <el-input placeholder="请输入一体杆名称:" style="width: 220px;"></el-input>
    <span>一体杆编号: </span>
    <el-input placeholder="请输入一体杆编号:" style="width: 220px;"></el-input>
    <span>运行状态: </span>
    <el-select placeholder="请选择运行状态:" style="width: 220px;">
      <el-option label="运行中" value="1"></el-option>
    </el-select>
    <el-button type="primary">查询</el-button>
  </div>
  <div class="btn-box">
    <el-button type="primary">添加一体杆</el-button>
    <el-button>批量删除</el-button>
  </div>
  <div class="table-box">
    <el-table :data="PoleDataList">
      <el-table-column label="序号"></el-table-column>
      <el-table-column label="一体杆名称" prop="poleName"></el-table-column>
      <el-table-column label="一体杆编号" prop="poleNumber"></el-table-column>
      <el-table-column label="一体杆IP" prop="poleIp"></el-table-column>
      <el-table-column label="安装区域" prop="areaName"></el-table-column>
      <el-table-column label="一体杆类型" prop="poleType"></el-table-column>
      <el-table-column label="运行状态" prop="poleStatus"></el-table-column>
      <el-table-column label="操作"></el-table-column>
    </el-table>
  </div>
  <div class="page-box">
     <el-pagination
      :page-sizes="[2, 5, 10, 20]"
      layout="total, sizes, prev, pager, next, jumper"
      :total="1000"
    />
  </div>
</template>

<style lang="scss" scoped>
.search-box{
  padding: 20px;
  display: flex;
  justify-content:start;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}
.btn-box{
  padding: 20px;
  display: flex;
  justify-content:start;
  align-items: center;
  gap: 5px;
}
.el-table{
  margin-left: 20px;
}
.page-box{
  display: flex;
  justify-content:flex-end;
  align-items: center;
  margin-top: 20px;
  margin-right: 20px;
}
</style>
